koblas

UmfpackFactorization

class UmfpackFactorization : SparseFactorization(source)

UMFPACK's numeric factors behind koblas's SparseFactorization, on the native targets.

The JVM twin of this class, with Cleaner swapped for createCleaner and MemorySegment for pinned Kotlin arrays. The reason both exist rather than one shared implementation is that nothing about the two foreign-function layers is common: there is no java.lang.foreign on native and no usePinned on the JVM. What is shared is everything that matters to a caller — the seam, the packed input format, the singular contract and the fill accounting all live in commonMain.

Holds its matrix alive because umfpack_di_solve takes Ap, Ai and Ax alongside the factors and the signature has no way to omit them.

Properties

failedAt

open override val failedAt: Int(source)

The pivot position that had no numerically acceptable candidate, or NOT_SINGULAR when the factorization succeeded.

The same convention com.eignex.koblas.dense.LuDecomposition reports, and the position is the actionable half: a simplex whose basis went singular can use it to choose which column to replace.

n

open override val n: Int(source)

The dimension of the factored matrix.

nnz

open override val nnz: Int(source)

Nonzeros in the factors — the fill. Zero for a singular factorization, which has none.

Link copied to clipboard
open val singular: Boolean

Whether the factorization failed for want of a numerically acceptable pivot. Derived from failedAt, so the two cannot disagree.

Functions

determinant

open override fun determinant(): Double(source)

det(B) from UMFPACK, reported as a mantissa and a base-10 exponent so the value survives a range the product of n pivots leaves a double long before n is large.

Recombining them here can still overflow to infinity, which is the honest answer for a value that does not fit.

solveInto

open override fun solveInto(b: DoubleArray, out: DoubleArray, transpose: Boolean = false, workspace: Workspace? = null): DoubleArray(source)

Solve B x = b, or Bᵀ x = b when transpose, into out, which is returned.

The two directions are a simplex's FTRAN and BTRAN. Allocates nothing when given a workspace, so an iteration that owns its destination runs without touching the collector. out may be b.

Link copied to clipboard
open fun solve(b: DoubleArray, transpose: Boolean = false): DoubleArray

Solve B x = b, or Bᵀ x = b when transpose, into a fresh result.